<style scoped lang="scss">
	.xy-list {
	}
</style>
<template>
    <checkbox-group @change="checkboxChange" class="xy-list">
        <slot />
    </checkbox-group>
</template>
<script>
export default {
    name: 'xyList',
    components: {
    },
    props: {
		value: {
            type: [Array,String,Number],
            default: () => {
                return [];
            }
        },
        selectType: {
            type: String,
            default: 'checkbox'
        },
    },
    data() {
        return {
        }
    },
    created: function () {
    },
    methods: {
        checkboxChange(evt){
            switch (this.selectType) {
                case 'checkbox':
                    this.$emit('input', evt.target.value);
                    break;
                case 'radio':
                    this.$emit('input', evt.target.value[0]);
                    break;
            }
		}
    }
}
</script>
